package com.ssm.util;
import com.ssm.service.TeacherService;
import com.ssm.service.impl.TeacherServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@Configuration  //用于表示当前类为容器的配置类，类似<beans/>
@ComponentScan(basePackages="com.ssm.util")  //扫描的范围，相当于xml配置的结点<context:component-scan/>
@EnableAspectJAutoProxy(proxyTargetClass=true)  //自动代理，相当于<aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>
public class Test {
    @org.junit.Test
    public void test() {
        ApplicationContext applicationContext=new AnnotationConfigApplicationContext(Test.class);
        Math math = applicationContext.getBean("math", Math.class);
        int n1 = 100, n2 = 5;
        math.add(n1, n2);
        math.subtract(n1, n2);
        math.mul(n1, n2);
        math.dev(n1, n2);
    }
}
